import { Button } from "antd";
import { useNavigate, Navigate, history } from "umi";

const OrderPage = () => {
  const navigate = useNavigate();
  const fn = () => {
    // 跳转路由
    // 不带参数跳转
    // navigate("/user/profile")

    // search传参（问号传参）数跳转
    // navigate({
    //   pathname: "/user/profile",
    //   search: "name=malu&age=100"
    // })

    // 隐式传参跳转
    // navigate("/user/profile", {
    //   state: {
    //     name: "wangcai",
    //     age: 18
    //   }
    // })

    // history跳转
    // history.push("/user/profile")
    // search传参（问号传参）数跳转
    // history.push({
    //   pathname: "/user/profile",
    //   search: "name=malu&age=100"
    // })
    // 在config.ts中配置了historyWithQuery: {}之后，可以开启history的query(也是问号传参)传参
    history.push({
      pathname: "/user/profile",
      query: {
        name: "malu",
        age: 18
      }
    })
  }
  
  return (
    <div>
      <h1>我的订单</h1>
      <Button type="primary" onClick={fn}>去Profile</Button>
    </div>
  );
};

export default OrderPage;
